package com.jsu.clubmanagementsystem.model.vo.clubAnnouncement;

import com.jsu.clubmanagementsystem.model.entity.ClubAnnouncement;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;

@Data
public class ClubAnnouncementVO implements Serializable {
    /**
     * 社团公告id
     */
    private Long id;

    /**
     * 所属社团id
     */
    private Long clubId;

    /**
     * 公告标题
     */
    private String title;

    /**
     * 公告内容
     */
    private String content;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 是否删除: 0-正常, 1-已过时
     */
    private String isDelete;

    private static final long serialVersionUID = 1L;

    public static ClubAnnouncementVO objToVo(ClubAnnouncement announcement) {
        ClubAnnouncementVO announcementVO = new ClubAnnouncementVO();
        BeanUtils.copyProperties(announcement, announcementVO);
        if(announcement.getIsDelete() == 1)
            announcementVO.setIsDelete("已过时");
        else
            announcementVO.setIsDelete("生效中");
        return announcementVO;
    }
}
